﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:ArgusControls="clr-namespace:ArgusControls">

	<Style TargetType="ArgusControls:FloatingControl">
		<Setter Property="HorizontalAlignment" Value="Left"/>
		<Setter Property="VerticalAlignment" Value="Top"/>
		<Setter Property="BorderBrush" Value="White"/>
		<Setter Property="Background" Value="Black"/>
		<Setter Property="Foreground" Value="White"/>
		<Setter Property="BorderThickness" Value="3"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ArgusControls:FloatingControl">
					<Grid x:Name="RootElement"
						  Width="{TemplateBinding Width}"
						  Height="{TemplateBinding Height}">
						<Rectangle Fill="{TemplateBinding BorderBrush}"/>
						<Rectangle x:Name="ResizeAreaN" Fill="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="{Binding RelativeSource={RelativeSource  TemplatedParent}, Path=BorderThickness.Top}" Cursor="SizeNS"/>
						<Rectangle x:Name="ResizeAreaS" Fill="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Bottom}" Cursor="SizeNS"/>
						<Rectangle x:Name="ResizeAreaW" Fill="Transparent" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Left}" Cursor="SizeWE"/>
						<Rectangle x:Name="ResizeAreaE" Fill="Transparent" HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Right}" Cursor="SizeWE"/>
						<Rectangle x:Name="ResizeAreaNW" Fill="Transparent" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Left}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Top}" Cursor="SizeNWSE"/>
						<Rectangle x:Name="ResizeAreaNE" Fill="Transparent" HorizontalAlignment="Right" VerticalAlignment="Top" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Right}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Top}" Cursor="SizeNESW"/>
						<Rectangle x:Name="ResizeAreaSE" Fill="Transparent" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Right}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Bottom}" Cursor="SizeNWSE"/>
						<Rectangle x:Name="ResizeAreaSW" Fill="Transparent" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Left}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Bottom}" Cursor="SizeNESW"/>
						<Grid x:Name="DragArea" Margin="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Cursor="Hand">
							<Rectangle x:Name="ClientArea"/>
							<ArgusControls:ClippingGrid Width="{TemplateBinding ClientWidth}" Height="{TemplateBinding ClientHeight}">
								<ContentPresenter  Content="{TemplateBinding Content}"/>
							</ArgusControls:ClippingGrid>
						</Grid>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="ArgusControls:FloatingWindow">
		<Setter Property="HorizontalAlignment" Value="Left"/>
		<Setter Property="VerticalAlignment" Value="Top"/>
		<Setter Property="BorderBrush" Value="White"/>
		<Setter Property="Background" Value="Black"/>
		<Setter Property="Foreground" Value="White"/>
		<Setter Property="BorderThickness" Value="3"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ArgusControls:FloatingWindow">
					<Grid x:Name="RootElement"
						  Width="{TemplateBinding Width}"
						  Height="{TemplateBinding Height}">
						<Rectangle Fill="{TemplateBinding BorderBrush}"/>
						<Rectangle x:Name="ResizeAreaN" Fill="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="{Binding RelativeSource={RelativeSource  TemplatedParent}, Path=BorderThickness.Top}" Cursor="SizeNS"/>
						<Rectangle x:Name="ResizeAreaS" Fill="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Bottom}" Cursor="SizeNS"/>
						<Rectangle x:Name="ResizeAreaW" Fill="Transparent" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Left}" Cursor="SizeWE"/>
						<Rectangle x:Name="ResizeAreaE" Fill="Transparent" HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Right}" Cursor="SizeWE"/>
						<Rectangle x:Name="ResizeAreaNW" Fill="Transparent" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Left}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Top}" Cursor="SizeNWSE"/>
						<Rectangle x:Name="ResizeAreaNE" Fill="Transparent" HorizontalAlignment="Right" VerticalAlignment="Top" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Right}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Top}" Cursor="SizeNESW"/>
						<Rectangle x:Name="ResizeAreaSE" Fill="Transparent" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Right}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Bottom}" Cursor="SizeNWSE"/>
						<Rectangle x:Name="ResizeAreaSW" Fill="Transparent" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Left}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness.Bottom}" Cursor="SizeNESW"/>
						<Grid Margin="{TemplateBinding BorderThickness}">
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"/>
								<RowDefinition/>
							</Grid.RowDefinitions>
							<Grid x:Name="DragArea" Grid.Row="0" Background="Transparent" Cursor="Hand" HorizontalAlignment="Stretch" VerticalAlignment="Top">
								<TextBlock Foreground="Black" Text="{TemplateBinding Title}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="2"/>
								<Button x:Name="CloseButton" Content="X" Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="2" Cursor="Arrow"/>
							</Grid>
							<Rectangle x:Name="ClientArea" Fill="{TemplateBinding Background}" Grid.Row="1"/>
							<ArgusControls:ClippingGrid Width="{TemplateBinding ClientWidth}" Height="{TemplateBinding ClientHeight}" Grid.Row="1">
								<ContentPresenter Content="{TemplateBinding Content}"/>
							</ArgusControls:ClippingGrid>
						</Grid>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>
